import Vue from 'vue'
import Router from 'vue-router'
import home from '@/pages/home/home.vue'
import City from '@/pages/city/City'
import Detail from '@/pages/detail/Detail'


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: home
    },{
    		path: '/city',
     	name: 'City',
    	  	component: City
    },{
    	//带有参数的动态路由
    		path: '/detail/:id',
     	name: 'Detail',
    	  	component: Detail
    }
  ],
  scrollBehavior (to, from, savedPosition) {
	  if (savedPosition) {
	    return savedPosition
	  } else {
	    return { x: 0, y: 0 }
	  }
	}
})
